import { lazy } from 'react'
import { Switch } from 'react-router-dom'
const  MapNav  = lazy(() =>   import('../pages/MapNav'))
const Lease    = lazy(() => import('../pages/lease'))
const Details  = lazy(() =>   import('../components/Details'))
const Resoldhouse  = lazy(() => import('../pages/ResoldHouse'))
const Useddetailshouse = lazy(() => import('../pages/UsedDetailsHouse'))
const Login = lazy(() => import('../pages/LoginPage_c'))
const RegisterPage = lazy(() => import("../pages/RegisterPage_c"));
const IndexPage = lazy(() => import('../pages/IndexPage_c'));
const MakePage  = lazy(() =>import('../pages/MakePage_c'));
const ServicePage  = lazy(() =>import('../pages/ServicePage_c'));
const homePage  = lazy(() => import('../pages/homePage'))
const calculator  = lazy(() =>import('../pages/Calculator'))

const FindNewHouse = lazy(() => import('../pages/findNewHouse'))
const SearchVillage = lazy(() => import('../pages/searchVillage'))
const Home = lazy(() => import('../pages/home'))
const User = lazy(() => import('../pages/user'))
const NewHouse = lazy(() => import('../pages/newHouse'))
const NewHousedetail = lazy(() => import('../pages/newHousedetail'))
const Gbuyhouse = lazy(() => import('../pages/Gbuyhouse.js'))
const GhouseEstate = lazy(() => import('../pages/GhouseEstate.js'))
const MyPage = lazy(() => import('../pages/MyPage_c'))
const PublishPage = lazy(() => import('../pages/PublishPage_c'))
const PayPage = lazy(() => import('../pages/PayPage_c'))
const BrowsePage = lazy(() => import('../pages/BrowsePage_c'))
const MsgPage = lazy(() => import('../pages/MsgPage_c'))
const ChatPage = lazy(() => import('../pages/ChatPage_c'))
const Yrelease = lazy(() => import('../pages/Yrelease'))
const YsecondSale= lazy(() => import('../pages/YsecondSale'))
const JrentHouse = lazy(() => import('../pages/JrentHouse'))
const WeChatPay=lazy(()=>import('../pages/WeChatPay'))
const NotFound = lazy(() => import('../pages/NotFound'))

const routes = [
    {
        path: "/",
        name: 'login',
        component: Login,
        exact: true,

    },
    {
        path: "/register",
        name: 'RegisterPage',
        component: RegisterPage,
        exact: true
    },
    {
        path: "/YsecondSale",
        name: 'YsecondSale',
        component: YsecondSale,
        exact: true
    },
    {
        path: "/make",
        name: 'make',
        component: MakePage,
        exact: true,
        auth: true,
    },
    {
        path: "/focus",
        name: 'focus',
        component: MakePage,
        exact: true,
        auth: true,
    },
    {
        path: "/service",
        name: 'service',
        component: ServicePage,
        exact: true,
        auth: true,
    },
    {
        path: "/my",
        name: 'my',
        component: MyPage,
        exact: true,
        auth: true,
    },
    {
        path: "/browse",
        name: 'browse',
        component: BrowsePage,
        exact: true,
        auth: true,
    },
    {
        path: "/publish",
        name: 'publish',
        component: PublishPage,
        exact: true,
        auth: true,
    },
    {
        path: "/pay",
        name: 'pay',
        component: PayPage,
        exact: true,
        auth: true,
    },
    {
        path: "/msg",
        name: 'msg',
        component: MsgPage,
        exact: true,
        auth: true,
    },
    {
        path: "/chat",
        name: 'chat',
        component: ChatPage,
        exact: true,
        auth: true,
    },
    {
        path: "/findNewHouse",
        name: 'FindNewHouse',
        component: FindNewHouse,
        exact: true,
        auth: true,
    },
    {
        path: "/searchVillage",
        name: 'SearchVillage',
        component: SearchVillage,
        exact: true,
        auth: true,
    },
    {
        path: "/home",
        name: 'home',
        component: Home,
        exact:false,
        children: [
            {
                path: "/home/user",
                name: 'user',
                component: User,
                exact: true,
                auth: true,
            },
            {
                path: "/home/newhouse",
                name: 'newhouse',
                component: NewHouse,
                exact: true
                , auth: true,
            },
            {
                path: "/home/lease",
                name: 'lease',
                component: Lease,
                exact: true
                , auth: true,
            },
            {
                path: "/home/calculator",
                name: 'calculator',
                component: calculator,
                exact: true,
                auth: true,
            },
            {
                path: "/home/homePage",
                name: 'homePage',
                component: homePage,
                exact: true,
                auth: true,
            },
            {
                path: "/home/Yrelease",
                name:  'Yrelease',
                component: Yrelease,
                exact: true,
                auth: true,
            },
            {
                path: "/home/my",
                name: 'my',
                component: IndexPage,
                exact: true,
                auth: true,
            },
            {
                path: "/home/resoldhouse",
                name: 'resoldhouse',
                component: Resoldhouse,
                exact: true,
                auth: true,
        
            },
            {
                name: "NotFound",
                component: NotFound,
                exact: true,
                auth: true,
                Switch
            }
        ]
    },
    {
        path: "/newHousedetail/:id",
        name: 'newHousedetail',
        component: NewHousedetail,
        exact: true,
        auth: true,
    },
    {
        path: "/MapNav",
        name: 'MapNav',
        component: MapNav,
        exact: true,
        auth: true,
    },
    {
        path: "/gbuyhouse",
        name: "gbuyhouse",
        component: Gbuyhouse,
        exact: true,
        auth: true,

    }
    , {
        path: "/houseestate",
        name: "houseestate",
        component: GhouseEstate,
        exact: true,
        auth: true,
    },
    {
        path: "/details/:id",
        name: 'Details',
        component: Details,
        exact: true,
        auth: true,
    },
    
    {
        path: "/useddetailshouse/:id",
        name: 'useddetailshouse',
        component: Useddetailshouse,
        exact: true,
        auth: true,
    },
    {
        path: "/jrenthouse",
        name: "jrenthouse",
        component: JrentHouse,
        exact: true,
        auth: true,
    },
    {
        path: "/WeChatPay",
        name: "WeChatPay",
        component: WeChatPay,
        exact: true,
        auth: true,
    }
    ,
    {
        name: "NotFound",
        component: NotFound,
        Switch
    },


]

export default routes
